﻿<%@ Page Language="C#" AutoEventWireup="true" MasterPageFile="~/MasterPage.master"
    Inherits="InStoreDataMeasures_MeasuresDetail_DragSelect_List" CodeFile="MeasuresDetail_DragSelect_List.aspx.cs" %>

<%@ Register Src="~/UserControl/GridPager.ascx" TagName="GridPager" TagPrefix="uc1" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <title>指标明细列表 </title>
     <style type="text/css">
        .drag
        {
            width: 530;
           
            padding: 10px;
            margin: 5px;
            border: 1px solid #ccc;
            background: #AACCFF;
        }
        .dp
        {
            opacity: 0.5;
            filter: alpha(opacity=50);
        }
        .over
        {
            background: #FBEC88;
        }
    </style>
   

</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
 <script type="text/javascript">
     $(function () {
         $('.drag').draggable({
             proxy: 'clone',
             revert: true,
             cursor: 'auto',
             onStartDrag: function () {
                 $(this).draggable('options').cursor = 'not-allowed';
                 $(this).draggable('proxy').addClass('dp');
             },
             onStopDrag: function () {
                 $(this).draggable('options').cursor = 'hand';
             }
         });
         $('#target').droppable({
             accept: '<%=allids %>',
             onDragEnter: function (e, source) {
                 $(source).draggable('options').cursor = 'hand';
                 $(source).draggable('proxy').css('border', '1px solid red');
                 $(this).addClass('over');
             },
             onDragLeave: function (e, source) {
                 //$(source).draggable('options').cursor = 'not-allowed';
                 $(source).draggable('proxy').css('border', '1px solid #ccc');
                 $(this).removeClass('over');
             },
             onDrop: function (e, source) {
                 $(this).append(source)
                 $(this).removeClass('over');
                 setValue($get(source.id).getAttribute("measuredata"), 1);
             }
         });
         $('#source').droppable({
             accept: '<%=allids %>',
             onDragEnter: function (e, source) {
                 $(source).draggable('options').cursor = 'hand';
                 $(source).draggable('proxy').css('border', '1px solid red');
                 $(this).addClass('over');
             },
             onDragLeave: function (e, source) {

                 $(source).draggable('proxy').css('border', '1px solid #ccc');
                 $(this).removeClass('over');
             },
             onDrop: function (e, source) {
                 $(this).append(source)
                 $(this).removeClass('over');
                 setValue($get(source.id).getAttribute("measuredata"), 0);
             }
         });
     });

     function setValue(value, action) {
         hidvalue = $get("<%=HiddenField1.ClientID %>");
         //txt_key = $get("<%=txt_key.ClientID %>");
         if (action == 1) {
          
             if (hidvalue.value.indexOf(value) <= 0) {
                 hidvalue.value = hidvalue.value + "," + value;
             }
         } else {
             
             hidvalue.value = hidvalue.value.replace("," + value, "");
         }
         //txt_key.value = hidvalue.value;

     }

    </script>
    <table id="wsd_inputtable" width="100%">
                    <tr>
                        <td class="tabletitle" colspan="7">
                            指标明细分配
                        </td>
                    </tr>
                    <tr>
                        <td class="tablefield">
                            关键字：
                        </td>
                        <td>
                            <asp:TextBox ID="txt_key" runat="server"></asp:TextBox>
                        </td>
                        <td class="tablefield">
                            &nbsp;</td>
                        <td>
                            &nbsp;</td>
                        <td class="tablefield">
                            有效：
                        </td>
                        <td>
                            <asp:DropDownList ID="ddl_active" runat="server">
                                <asp:ListItem Value="">--全部--</asp:ListItem>
                                <asp:ListItem Selected="True" Value="1">--有效--</asp:ListItem>
                                <asp:ListItem Value="0">--无效--</asp:ListItem>
                            </asp:DropDownList>
                        </td>
                        <td>
                            <asp:Button ID="btnSearch" runat="server" class="wsd_button2" CausesValidation="false"
                                Text="查 询" OnClick="btnSearch_Click" />
                        </td>
                    </tr>
                </table>
   
            <div>
                <table id="wsd_listtable" width="100%">
                    <tr>
                        <td style="width: 49%">
                        &nbsp;未分配
                            <div id="source" style="border: 1px solid #ccc; width: 100%; height: 360px; float: left;margin: 5px; overflow-y:auto">
                               <%=sourcedivs %>
                            </div>
                        </td>
                        <td style="width: 49%">
                        &nbsp;已分配
                            <div id="target"  style="border: 1px solid #ccc; width: 98%; height: 360px; float: left;margin: 5px;overflow-y:auto">
                               <%=targetdivs%>
                            </div>
                        </td>
                    </tr>
                </table>
                <asp:HiddenField ID="HiddenField1" runat="server" />
                <br />
                <table id="wsd_inputtable">
                    <tr>
                        <td width="100%" class="tabletitle">
                            操作选项
                        </td>
                    </tr>
                    <tr>
                        <td class="buttonarea">
                            <asp:Button ID="btnSave" runat="server" CausesValidation="false" class="wsd_button2"
                                Text="保 存" onclick="btnSave_Click" style="height: 21px" />
                        <input class="wsd_button2" onclick="window.history.go(-1);" type="button" value="返  回" __designer:mapid="18c0" /></td>
                    </tr>
                </table>
            </div>
           
      
</asp:Content>
